package com.sddz.pacs.entity;

import java.util.Date;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 系统用户信息表
 * </p>
 *
 * @author 时代电子
 * @since 2018-05-16
 */
public class SysUser extends Model<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private String id;

    /**
     * 用户名称
     */
    @NotBlank(message = "请输入用户名称!")
    private String userName;

    /**
     * 登录名称
     */
    @NotBlank(message = "请输入登录名称!")
    private String loginName;

    /**
     * 登录密码（密文存储）
     */
    private String password;

    /**
     * 密码加密盐值
     */
    private String salt;

    /**
     * 是否禁用（1.是 0.否）
     */
    @NotBlank(message = "请输入用户状态!")
    private String status;

    /**
     * 用户手机号
     */
    @Pattern(regexp="^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$", message="请检查手机号格式是否正确")
    private String phone;

    /**
     * 用户邮箱
     */
    @Email(regexp ="^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$",    message = "请检查邮箱格式是否正确")
    private String email;

    /**
     * 机构ID,此项为机构表主键ID
     */
    @NotBlank(message = "请输入所属机构!")
//    private String organId;

    /**
     * 部门ID,此项为部门表主键ID
     */
//    private String deptId;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date createDate;

    /**
     * 创建人ID
     */
    private String createUserid;

    /**
     * 修改人ID
     */
    private String updateUserid;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date updateDate;

    /**
     * 备注
     */
    private String remark;

    /**
     * 是否删除（1是0否）
     */
    @TableLogic
    private Integer isdel;

    /**
     * 有限期限
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date endDate;

    /**
     * 权限列表
     * @return
     */
    @TableField(exist = false)
    private Set<String> permissions;

    /*
    用户所拥有的角色
     */
    @TableField(exist = false)
    private List<SysRole> roleList;

    /*
    用户所拥有的角色id
     */
    @TableField(exist = false)
    private List<String> roleIdList;

    /**
     * 0 橋西區  1橋東區
     */
    private String state;
    /**
     * 父id
     */

    private String parentId;

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getStationId() {
        return stationId;
    }

    public void setStationId(String stationId) {
        this.stationId = stationId;
    }

    public Integer getLevels() {
        return levels;
    }

    public void setLevels(Integer levels) {
        this.levels = levels;
    }

    private String stationId;
    private Integer levels;



    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
    //    public String getOrganId() {
//        return organId;
//    }
//
//    public void setOrganId(String organId) {
//        this.organId = organId;
//    }
//    public String getDeptId() {
//        return deptId;
//    }
//
//    public void setDeptId(String deptId) {
//        this.deptId = deptId;
//    }
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    public String getCreateUserid() {
        return createUserid;
    }

    public void setCreateUserid(String createUserid) {
        this.createUserid = createUserid;
    }
    public String getUpdateUserid() {
        return updateUserid;
    }

    public void setUpdateUserid(String updateUserid) {
        this.updateUserid = updateUserid;
    }
    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Integer getIsdel() {
        return isdel;
    }

    public void setIsdel(Integer isdel) {
        this.isdel = isdel;
    }

    public Set<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(Set<String> permissions) {
        this.permissions = permissions;
    }

    public List<SysRole> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<SysRole> roleList) {
        this.roleList = roleList;
    }


    public List<String> getRoleIdList() {
        return roleIdList;
    }

    public void setRoleIdList(List<String> roleIdList) {
        this.roleIdList = roleIdList;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "id=" + id +
                ", userName=" + userName +
                ", loginName=" + loginName +
                ", password=" + password +
                ", salt=" + salt +
                ", status=" + status +
                ", phone=" + phone +
                ", email=" + email +
//        ", organId=" + organId +
//        ", deptId=" + deptId +
                ", createDate=" + createDate +
                ", createUserid=" + createUserid +
                ", updateUserid=" + updateUserid +
                ", updateDate=" + updateDate +
                ", remark=" + remark +
                ", isdel=" + isdel +
                ", endDate=" + endDate +
                ", stationId=" + stationId +
                ", levels=" + levels +
                ", state=" + state +
                ", parentId=" + parentId +
                "}";
    }
}
